package com.cf.user.login.model;

import com.cf.code.core.CField;
import com.cf.code.core.CModel;
import com.cf.code.core.CPage;
import com.cf.crud.entity.BaseEntity;
import com.cf.user.core.EnumLoginChannel;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * game-server-ThirdPartUser
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/5/28 下午 07:21
 */
@Entity
@Table(name = "thirdPartUser",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"channel", "unionId"}),
                @UniqueConstraint(columnNames = {"account"})
        }
)
@CModel(pages = {
        @CPage(title = "登陆方式", path = "thirdPartUser", templateName = "list.ftl", outPutName = "list.ftl"),
        @CPage(title = "登陆", path = "thirdPartUser", templateName = "add.ftl", outPutName = "add.ftl"),
        @CPage(title = "登陆", path = "thirdPartUser", templateName = "update.ftl", outPutName = "update.ftl")
})
public class ThirdPartUser extends BaseEntity {

    @CField(lab = "openId")
    @Column(name = "openId")
    private String openId;

    @CField(lab = "平台唯一Id")
    @Column(name = "unionId")
    private String unionId;

    @CField(lab = "用户Id")
    @Column(name = "userId")
    private long userId;

    @CField(lab = "登陆账号")
    private String account;

    @CField(lab = "登录密码")
    private String pwd = "";

    private String channel = EnumLoginChannel.COMMON.getChannel();

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }


    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }


    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }
}
